//
//  UIButton+CoverView.swift
//  Home_school_晓林
//
//  Created by 张晓林 on 16/9/13.
//  Copyright © 2016年 张晓林. All rights reserved.
//

import UIKit

extension UIButton {
    
    
    /// 遮盖视图
    ///
    /// - parameter alp: 透明度
    ///
    /// - returns: 遮盖视图
    convenience init(coverView alp:CGFloat) {
        self.init()
        self.frame = UIScreen.main.bounds
        backgroundColor = UIColor.lightGray
        alpha = alp
    }
    
    
    /// 普通按钮视图
    ///
    /// - parameter frame:   frame
    /// - parameter bgImage: 背景图片
    /// - parameter title:   标题
    ///
    /// - returns: 按钮视图
    convenience init(frame: CGRect, bgImage: String, title: String) {
        self.init(frame: frame)
        setBackgroundImage(UIImage(named: bgImage), for: .normal)
        setBackgroundImage(UIImage(named: bgImage), for: .highlighted)
        setTitle(title, for: .normal)
        setTitle(title, for: .highlighted)
        backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
    }

}
